home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Video / VideoWrapper.h < prev   
Encoding:
C/C++ Source or Header  |  2000-05-19  |  3.4 KB  |  179 lines

  1. #ifndef VIDEOWRAPPER_H
  2. #define VIDEOWRAPPER_H
  3.  
  4. #define DECODER_READ_BUFFER    2048
  5. #define SEQ_FINISHED        234
  6. #define SEQ_STARTED         235
  7. #define SEQ_FIRSTTIME        236
  8.  
  9. //ERRORS
  10. #define END_OF_STREAM    1
  11. #define PLAYER_STOPPED   2
  12.                 
  13.  
  14. #define MEM_Y  1024*1024
  15. #define MEM_C  1024*1024
  16.  
  17.  
  18. #include "..\Demux\Demux.h"
  19. #include "..\FlasKMPEG.h"    // Added by ClassView
  20. #include "..\YUVtoRGB.h"
  21.  
  22. #define FREE         0
  23. #define FULL         3
  24.  
  25. #define MINUS        4
  26. #define EQUAL        5
  27. #define PLUS         6
  28. //#define TOP_FIELD    2
  29. //#define BOTTOM_FIELD 3
  30.  
  31. #define A            0
  32. #define B            1
  33. struct TRecImage 
  34. {
  35.     YUVImageTag im;
  36.     int      state;
  37.     i64      PTS;
  38. };
  39.  
  40. struct TDoubleBuffer
  41. {
  42.     TRecImage *rec[2];
  43. };
  44.  
  45. typedef struct timeCodeTag
  46. {
  47.     int hour;
  48.     int minute;
  49.     int second;
  50.     int frame;
  51. } TTimeCode;
  52.  
  53. struct presInfo
  54. {
  55.     i64 imagePTS;
  56.     i64 imageSCR;
  57.     bool SCRlocked;
  58. };
  59.  
  60. struct TFrameInfo
  61. {
  62.     i64 PTS;
  63.     i64 SCR;
  64.     int progressive_frame;
  65.     int repeat_first_field;
  66.     int picture_structure;
  67.     int top_field_first;
  68. };
  69.  
  70. struct presTimes
  71. {
  72.     TFrameInfo actual;
  73.     TFrameInfo image;
  74.     TFrameInfo fordward;
  75.     TFrameInfo backward;
  76. };
  77.  
  78. struct TVideoOptions
  79. {
  80.     int   idctType;
  81.     bool  recons_progressive;
  82. };
  83.  
  84.  
  85. class VideoWrapper: public CDemux
  86. {
  87. public:
  88.     int subStreamID;
  89.     int streamID;
  90.     int subpic_substreamID, subpic_streamID; /* -1 = off */
  91.     char * GetVideoFileName();
  92.     i64  GetVideoSize();
  93.     i64 GetVideoPos();
  94.     bool seqIsProgressive;
  95.     int GetFrameRateCode(double fr);
  96.     bool gopFlag;
  97.     bool SCRlocked;
  98.     i64 previousPicSCR;
  99.     presTimes    p;
  100.     __int64             internalPTS;
  101.     char sDetectedFPS[256];
  102.     char sAspectRatio[256];
  103.     char sFrameRate[256];
  104.     char sVideoSize[256];
  105.     char sBitrate[256];
  106.     char sProgressive[256];
  107.     bool PTSlocked;
  108.     int GetError();
  109.  
  110.     double frameDelay;
  111.     double frameRate;
  112.     double DAR;
  113.     unsigned int totalFrames;
  114.     int SeekVideo( __int64 pos );
  115.     YUVimage YUV;
  116.     bool    isDecoding;
  117.     bool    stopDecoding;
  118.     int        Start(TVideoOptions *opt);
  119.     int        Stop();
  120.     VideoWrapper( char *inputFile, int streamID, int subStreamID, int subpic_streamID, int subpic_substreamID, int mode );
  121.     ~VideoWrapper();
  122.     int                pictureWidth;
  123.     int                picutreHeight;
  124.     int        VideoWrapper::GetFrame(presInfo *pInfo, YUVImageTag **frame);
  125.     TTimeCode        timeCode;
  126.     int             idctType;
  127.     unsigned int    endTime, time;
  128.     PESinfo            myPES;
  129.     void ResetRawPTS();    int detectedFrameRateCode;
  130.     __int64         firstSCR, lastSCR, firstPTS, lastPTS;
  131. private:
  132.     bool justStarted;
  133.     i64 get_time(int field);
  134.     void swap_db();
  135.     TRecImage  reca;
  136.     TRecImage  recb;
  137.     int        rec_first;
  138.     TDoubleBuffer dbuf;
  139.     //Pull down stuff
  140.     int     get_frame();
  141.     int     guess_32pulldown();
  142.     void    adjust_pulldown_timing();
  143.     i64     interlaced_field_delay;
  144.     i64     progressive_frame_delay;
  145.     int     pulldown_state;
  146.     bool    pullDownDetected;
  147.     bool    recons_progressive;
  148.  
  149.     double  detectedFrameDelay;
  150.     int     prevProgressiveFrame;
  151.     int     prevRepeatFirstField;
  152.  
  153.  
  154.     int detectFrameRate();
  155.     double detectedFrameRate;
  156.  
  157.     updateVideoStats();
  158.     int error;
  159.  
  160.     int                outGopPos;
  161.  
  162.     bool            StartingDecoder;
  163.     bool            firstReadTime;
  164.     bool            stopDecoder;
  165.     bool            decoderStopped;
  166.     int Return_Value;
  167.     int                Bitstream_Framenum;
  168.     int                Sequence_Framenum;
  169.     int                sequencePos;
  170.     char            startBuffer[DECODER_READ_BUFFER];
  171.  
  172. };
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179. #endif